﻿using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Data;

namespace STHPMS1.ICore.I_BLL.Bus
{
    public interface IDn_Divi_ResultBill : IBll
    {
        double GetPciByModel(IDn_Divi_Result result, int year);
        /// <summary>
        /// 获取大修的预测PCI
        /// </summary>
        /// <param name="r"></param>
        /// <param name="y"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        double GetThick_Max(IDn_Divi_Planning r, int y, IDn_Divi_Result result, ref string modelPci);
        /// <summary>
        /// 获取中修的预测PCI
        /// </summary>
        /// <param name="r"></param>
        /// <param name="y"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        double GetThick_Mid(IDn_Divi_Planning r, int y, IDn_Divi_Result result, ref string modelPci);
        /// <summary>
        /// 获取单个决策路段
        /// </summary>
        /// <param name="MAINSEGID"></param>
        /// <returns></returns>
        IDn_Divi_Result GetSingle(string MAINSEGID);
      

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="p_dictid">面层类型</param>
        /// <param name="b_dictid">基层类型</param>
        /// <param name="m_dictid">养护类型</param>
        /// <param name="yftype">预防性养护措施</param>
        /// <param name="thick">面层厚度</param>
        /// <returns></returns>
        IDm_Modelgroup GetModel<T>(int p_dictid, int b_dictid, int m_dictid, string yftype, double thick) where T : class ,IDm_Modelgroup;
        /// <summary>
        /// 获取预防性养护措施
        /// </summary>
        /// <param name="anniname">资金模型名称</param>
        /// <param name="year">去年年度</param>
        /// <returns></returns>
        string GetMeas_ini(string anniname, int year);
        /// <summary>
        /// 查询面层厚度
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="dir"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <returns></returns>
        double GetThick_S(string rdid, int dir, double start, double end);
        /// <summary>
        /// 查询当年度该决策路段的各项指标平均值(默认取最近年度的检测数据)
        /// </summary>
        /// <param name="r"></param>
        /// <returns></returns>
        DataRow GetTe_Data(IDn_Divi_Result r);
        /// <summary>
        /// 根据路网对象查询适合该路网的决策路段
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="roadnet"></param>
        /// <returns></returns>
        IEnumerable<T> GetResulst<T>(IB_Roadnet roadnet) where T : class, IDn_Divi_Result;
        /// <summary>
        /// 更新养护路段的养护方式和划分方式
        /// </summary>
        /// <param name="diviList"></param>
        void Update(IDn_Divi_Result[] diviList);
        void Save<T>(T entity) 
            where T:class ,IDn_Divi_Result;

        void Remove(IDn_Divi_Result entity);
        void RemoveAll(IDn_Divi_Result entity);

        /// <summary>
        /// 根据路线和方向方法最新的路段划分结果
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rdwaryId"></param>
        /// <param name="dir"></param>
        /// <returns></returns>
        IEnumerable<T> GetNewSegment<T>(string rdwaryId, string m_w, ICore.I_Entity.Info.IPagingInfo info)
               where T : class, IDn_Divi_Result;

        /// <summary>
        /// 查询该方向的最新养护路段
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rdwaryId"></param>
        /// <param name="dir"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        IEnumerable<T> GetNewRoad<T>(string rdwaryId, string dir, ICore.I_Entity.Info.IPagingInfo info)
           where T : class, IDn_Divi_Result;
        /// <summary>
        /// 保存养护路段和单元关联
        /// </summary>
        /// <param name="result">养护路段</param>
        /// <param name="ius">养护路段和单元关联</param>
        void SaveAll<T1, T2>(T1[] result, T2[] ius)
            where T2 : IB_Invntory_Unit
            where T1 : IDn_Divi_Result;


        int GetLastYear(string rdwayid, string mainsegid);

        double GetRoadLenght(string rdwayid, string mainsegid);
        double GetRoadAera(string rdwayid, string mainsegid);

        /// <summary>
        /// 删除指定划分类型的养护路段和关联单元
        /// </summary>
        /// <param name="rdid">路线编号</param>
        /// <param name="gf_zb">规范_指标</param>
        void Clear(string rdid, string gf_zb);
        /// <summary>
        /// 返回本年度的养护方案(养护类型和划分时间)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="rdwaryId"></param>
        /// <returns></returns>
        IEnumerable<T> GetMainNeedWay<T>(string rdwaryId) where T : class, IDn_Divi_Result;
        /// <summary>
        /// 删除指定路线中非此类划分类型的养护路段和关联单元
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="gf_zb"></param>
        void ClearOther(string rdid, string gf_zb);

        /// <summary>
        /// 删除指定路线和方向的养护路段和关联单元
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="dir"></param>
        void ClearOtherChart(string rdid, string dir);

        /// <summary>
        /// 返回养护路段信息和评定指标的平均值
        /// </summary>
        /// <param name="rdid"></param>
        /// <param name="dir"></param>
        /// <returns></returns>
        DataTable GetRoadAvgZB(string rdid, string dir);
    }
}
